package cn.edu.tju.core.model;

import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * 交易流水 - 贫血模型
 */
@TableName("t_transaction")
public class Transaction implements Serializable {
    
    @TableId(type = IdType.AUTO)
    private Long id;
    
    /** 交易流水号 */
    private String transactionNo;
    
    /** 钱包ID */
    private Long walletId;
    
    /** 用户ID */
    private Integer userId;
    
    /** 
     * 交易类型
     * RECHARGE - 充值
     * WITHDRAW - 提现
     * PAYMENT - 支付
     * RECEIVE - 收款
     * FREEZE - 冻结
     * UNFREEZE - 解冻
     * DEDUCT_FROZEN - 扣除冻结金额
     * INTEREST - 透支利息
     */
    private String type;
    
    /** 交易金额（正数为增加，负数为减少） */
    private BigDecimal amount;
    
    /** 交易前余额 */
    private BigDecimal balanceBefore;
    
    /** 交易后余额 */
    private BigDecimal balanceAfter;
    
    /** 关联的钱包ID（用于转账） */
    private Long relatedWalletId;
    
    /** 关联的交易ID（用于配对收付款记录） */
    private Long relatedTransactionId;
    
    /** 关联的订单ID */
    private Long orderId;
    
    /** 交易描述 */
    private String description;
    
    /** 交易状态: SUCCESS-成功, FAILED-失败, PENDING-处理中 */
    private String status = "SUCCESS";
    
    @TableField(fill = FieldFill.INSERT)
    private Timestamp createdAt;
    
    // Getters and Setters
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTransactionNo() {
        return transactionNo;
    }

    public void setTransactionNo(String transactionNo) {
        this.transactionNo = transactionNo;
    }

    public Long getWalletId() {
        return walletId;
    }

    public void setWalletId(Long walletId) {
        this.walletId = walletId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public BigDecimal getBalanceBefore() {
        return balanceBefore;
    }

    public void setBalanceBefore(BigDecimal balanceBefore) {
        this.balanceBefore = balanceBefore;
    }

    public BigDecimal getBalanceAfter() {
        return balanceAfter;
    }

    public void setBalanceAfter(BigDecimal balanceAfter) {
        this.balanceAfter = balanceAfter;
    }

    public Long getRelatedWalletId() {
        return relatedWalletId;
    }

    public void setRelatedWalletId(Long relatedWalletId) {
        this.relatedWalletId = relatedWalletId;
    }

    public Long getRelatedTransactionId() {
        return relatedTransactionId;
    }

    public void setRelatedTransactionId(Long relatedTransactionId) {
        this.relatedTransactionId = relatedTransactionId;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId2) {
        this.orderId = orderId2;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Timestamp getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }
}